<include file="public@storage"/>
</head>
<body>
<div class="container body-content" style="margin-top:20px;width: 100%">
    <div class="panel panel-info" style="margin-bottom: 0.5rem">
        <div class="panel-heading">PDA版本管理</div>
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-12">

                    <div id="toolbar" class="btn-group">
                        <button class="btn btn-info" style="margin-left: 5px;width: 10rem" onclick="addVersion()">
                            更新PDA版本
                        </button>
                    </div>
                    <table id="table"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>

    $(function () {
        init();
    });

    function init() {
        var url = "{:url('storage/ClientPda/clientVersionInfo')}";
        var columns = [
            {
                title: '序号',
                width: 50,
                align: "center",
                valign: 'middle',
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                title: 'id',
                field: 'id',
                visible: false
            },
            {
                title: 'code',
                field: 'code',
                visible: false
            },
            {
                title: 'type',
                field: 'type',
                visible: false
            },
            {
                title: '客户端名称',
                field: 'name',
                align: "center",
            },
            {
                title: '主版本号',
                field: 'major_version',
                align: "center",
            },
            {
                title: '次版本号',
                field: 'minor_version',
                align: "center",
            },
            {
                title: '下载链接',
                field: 'url',
                align: "center",
            },
            {
                title: 'description',
                field: 'description',
                visible: false
            },
            {
                title: 'size',
                field: 'size',
                visible: false
            },
            {
                title: 'is_newest',
                field: 'is_newest',
                visible: false
            },
            {
                title: 'update_type',
                field: 'update_type',
                visible: false
            },
            {
                title: 'status',
                field: 'status',
                visible: false
            },
            {
                title: 'create_time',
                field: 'create_time',
                visible: false
            },
            {
                title: '操作',
                field: 'id',
                width: 200,
                align: "center",
                valign: 'middle',
                formatter: function (value, row, index) {
                    var html = '<a href="{:url(\'storage/ClientPda/edit\')}?clientVersionId=' + row.id + '">编辑</a>';
                    html += '&nbsp&nbsp|&nbsp&nbsp';
                    html += '<a onclick="del(this)" href="javascript:;" data-id="' + row.id + '" data-name="'+ row.name+'">删除</a>';
                    return html;
                }
            }
        ];
        initTable(url, columns, 'client',false);
    }

    del = function (that) {
        var id = $(that).data('id');
        var name = $(that).data('name');
        var url = "{:url('ClientPda/deleteVersion')}";
        var param = {versionId: id};
        reviseTable('是否删除' + name, url, param);
    }

    addVersion = function () {
        window.open('/storage/Client_Pda/add', '_self');
    }
</script>

</html>